import db from "../db";

export default defineEventHandler(async (event) => {
  try {
    const [rows] = await db.query(`SELECT company_id,company_name,description,phone,email,address,wechat_code,wechat_wa_code FROM company_info LIMIT 1`);
    const record = (rows as any[])[0]; // 将 rows 断言为 any[]
    return {
      code: 1,
      message: "成功",
      data: record,
    };
  } catch (error) {
    console.error(error);
    return {
      code: 500,
      message: "服务器错误",
    };
  }
});
